# -*- coding: utf-8 -*-
# @Time    : 2024/8/30 16:42
# @Author  : Alvin
# @File    : calculate.py
from app.models.users import User

def check_has_enough_points_to_download(user, required_points):
    # 查询其余额
    points_balance = user.points_balance
    remaining_points = points_balance - required_points
    # 足够余额
    if remaining_points >= 0:
        return True, points_balance, remaining_points
    else:
        return False, points_balance, None
